package com.brian.app_core_libstarter.application;

import android.app.Application;
import android.os.Build;

import androidx.annotation.RequiresApi;

import com.brian.app_core_libstarter.application.impl.DispatchRunnable;
import com.brian.app_core_libstarter.application.task.ThreadTask;

/**
 * @ProjectName: PathFinder
 * @Package: com.brian.app_core_libstarter.application
 * @ClassName: ApplicationTaskManagerService
 * @Description: App 启动器 装饰器 外部调用的类
 * @Author: Brian
 * @CreateDate: 2019/11/23 21:08
 * @UpdateUser: Brian
 * @UpdateDate: 2019/11/23 21:08
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public class ApplicationTaskManagerService {

    private TaskDispatcher dispatcher;

    public ApplicationTaskManagerService() {
        this.dispatcher = new TaskDispatcher();
    }

    public void init(Application application){

    }

    public ApplicationTaskManagerService addTask(ThreadTask threadTask){
        this.dispatcher.addTask(threadTask);
        return this;
    }

    public ApplicationTaskManagerService start(){
        this.dispatcher.start();
        return this;
    }

    public ApplicationTaskManagerService cancle(){
        this.dispatcher.cancle();
        return this;
    }

    public ApplicationTaskManagerService await(){
        this.dispatcher.await();
        return this;
    }

}
